import React, {useContext, useRef, useEffect} from 'react';
import {
  View,
  PanResponder,
  Alert,
  Platform,
  ScrollView,
  FlatList,
} from 'react-native';
import dayjs from 'dayjs';
import Toast from 'react-native-root-toast';
import {useNavigation} from '@react-navigation/native';
import {useDebounceEffect, useMount, useUnmount, useSafeState} from 'ahooks';
import {Text, Button, Input, Dialog, ListItem, Avatar} from '@rneui/themed';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import {useSelector, useDispatch} from 'react-redux';
import AsyncStorage from '@react-native-async-storage/async-storage';
import GlobalContext from '@/GlobalContext';
import ImagePicker from 'react-native-image-crop-picker';
import fileExtension from 'file-extension';
import {ApiHost, OssHost} from '@/config/common';
import {setKeyGetAccountInfo} from '@/store';
import DocumentPicker from 'react-native-document-picker';

import RNFS from 'react-native-fs';
import RNFetchBlob from 'react-native-blob-util';
import {round} from 'lodash';
export default () => {
  const {localMongoDbFileSystem} = useContext(GlobalContext);

  return (
    <>
      <Button
        title="清空"
        onPress={async () => {
          const start = dayjs();
          let docs = [];
          try {
            const db = localMongoDbFileSystem;
            let res = await db.removeAsync({}, {multi: true});
            console.log('清空了', 'res', res);
          } catch (e) {}

          const end = dayjs();
          console.log(
            '  end:',
            end.format(),
            'use',
            end.diff(start, 'ms'),
            'ms',
          );
        }}
        containerStyle={{
          margin: 10,
        }}
      />
    </>
  );
};
